package uid.jsf;

import java.util.ArrayList;
import java.util.List;

public class SelectOneRadio extends ComponenteAbstrato {

	private List<Select> items;
	private String value;

	public SelectOneRadio(String id, String value) {
		super(id);
		this.items = new ArrayList<Select>();
		this.setValue(value);
	}

	public void adicionarSelect(Select select) {
		this.items.add(select);
	}

	public void setValue(String value) {
		this.value = value;
	}

	@Override
	public String getJSF() {

		String r = "<h:selectOneRadio value=\"" + this.value + "\">" + "\n";

		for (Select s : this.items) {
			r += s.getJSF() + "\n";
		}

		r += "</h:selectOneRadio>" + "\n";

		return r;
	}
}
